import {localStg} from '@/utils/storage';

/** Get token */
export function getToken() {
  return localStg.get('token') || '';
}

/** Get user info */
export function getUserInfo() {
  const emptyInfo: Api.Entity.User = {
    id: 0,
    nickName: '',
    email: '',
    enabled: true,
    role: null,
    avatar: '',
    phoneNumber: ''
  };
  const userInfo: Api.Entity.User = localStg.get('userInfo') || emptyInfo;
  // console.log("userInfo:", userInfo);
  return userInfo;
}

/** Clear auth storage */
export function clearAuthStorage() {
  localStg.remove('token');
  localStg.remove('refreshToken');
  localStg.remove('userInfo');
}
